package com.tsn.factory;

import com.tsn.dao.HelloDao;
import com.tsn.dao.impl.HelloDaoImpl;

import java.io.IOException;
import java.util.Properties;

/**
 * <p>
 * 工厂类
 * </p>
 *
 * @author tsn
 * @since 2021/10/26
 */
public class BeanFactory {
    private  static Properties properties;

    static {
        properties = new Properties();
        try {
            properties.load(BeanFactory.class.getClassLoader().getResourceAsStream("factory.properties"));
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    public static HelloDao getDao(){
        String value = properties.getProperty("helloDao");
        System.out.println(value);
        return new HelloDaoImpl();
    }
}
